**************************************************************************
* Replication data for                                                   *
*                                                                        *
* ECONOMIC VOTE AND GLOBALIZATION BEFORE AND DURING THE GREAT RECESSION  *
**************************************************************************

use "C:\...\Global 2000-2015.dta"

xtset id year


**************************************
***             ARTICLE            ***
**************************************


***** Baseline model with level of unemployment , re (Tab. 1)

xtreg votesgov lagvotesgov wunemp wpcgrowth deltaturnout enep coalition if crisis==0, re
outreg2 using output1a.doc, replace ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o))
xtreg votesgov lagvotesgov wunemp wpcgrowth deltaturnout enep coalition if crisis==1, re
outreg2 using output1a.doc, append ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o))



***** Interacting globalization with unemployment (Figure 1 and Table A.4)

** Economic globalization

xtreg votesgov lagvotesgov c.wunemp##c.ecokof wpcgrowth deltaturnout enep coalition if crisis==0, re
outreg2 using output4.doc, replace ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp ecokof polkof wpcgrowth deltaturnout enep coalition)
margins, dydx(wunemp) at(ecokof =(42(1)93)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist ecokof if crisis==0, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
xtitle(ECONOMIC GLOBALIZATION) title("(2000-2007)")

xtreg votesgov lagvotesgov c.wunemp##c.ecokof wpcgrowth deltaturnout enep coalition if crisis==1, re
outreg2 using output4.doc, append ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp ecokof polkof wpcgrowth deltaturnout enep coalition)
margins, dydx(wunemp) at(ecokof =(57(1)88)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist ecokof if crisis==1, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
xtitle(ECONOMIC GLOBALIZATION) title("(2008-2015)")


** Political globalization

xtreg votesgov lagvotesgov c.wunemp##c.polkof wpcgrowth deltaturnout enep coalition if crisis==0, re
outreg2 using output4.doc, append ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp ecokof polkof wpcgrowth deltaturnout enep coalition)
margins, dydx(wunemp) at(polkof =(53(1)99)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist polkof if crisis==0, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
xtitle(POLITICAL GLOBALIZATION) title("(2000-2007)")

xtreg votesgov lagvotesgov c.wunemp##c.polkof wpcgrowth deltaturnout enep coalition if crisis==1, re
outreg2 using output4.doc, append ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp ecokof polkof wpcgrowth deltaturnout enep coalition)
margins, dydx(wunemp) at(polkof =(59(1)99)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist polkof if crisis==1, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
xtitle(POLITICAL GLOBALIZATION) title("(2008-2015)")


**************************************
***            APPENDIX            ***
**************************************


*************************************************
***Correlations between globalization indices ***
*************************************************

by crisis, sort : pwcorr ecokof polkof, sig


**************************************
***            Robustness          ***
**************************************




**************************************
*** Interactive research strategy  ***
**************************************


***** Baseline (Table A.5 - Fig. A.1)
xtreg votesgov lagvotesgov c.wunemp##c.crisis wpcgrowth deltaturnout enep coalition, re
outreg2 using taba5.doc, dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp wpcgrowth crisis deltaturnout enep coalition)
margins, dydx(wunemp) at(crisis=(0(1)1)) vsquish
marginsplot, yline(0, lcolor(red)) ytitle("Marginal Effect of UNEMPLOYMENT", axis(1)) title("")


***** Triple interaction with globalization (Table A.6 - Fig. A.2)

** Economic globalization

xtreg votesgov lagvotesgov c.wunemp##c.ecokof##c.crisis wpcgrowth deltaturnout enep coalition, re
outreg2 using taba6.doc, dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp wpcgrowth crisis deltaturnout enep coalition)
margins, dydx(wunemp) at(ecokof=(40(1)95) crisis=(1 0) ) vsquish
marginsplot, recast(line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist ecokof, percent yaxis(2) bin(20)  legend(order (3 "before the crisis" 4 "during the crisis")) /// 
lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2))) xtitle(ECONOMIC GLOBALIZATION) title("")

*Political globalization

xtreg votesgov lagvotesgov c.wunemp##c.polkof##c.crisis wpcgrowth deltaturnout enep coalition, re
outreg2 using taba6.doc, append
margins, dydx(wunemp) at(polkof=(50(1)99) crisis=(1 0) ) vsquish
marginsplot, recast(line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist polkof, percent yaxis(2) bin(20)  legend(order (3 "before the crisis" 4 "during the crisis")) ///
lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2))) xtitle(POLITICAL GLOBALIZATION) title("")



*********************************************************************
***** Compare unemployment, growth, inflation (Table A.7 - A.8)   ***
*********************************************************************

xtreg votesgov lagvotesgov wunemp deltaturnout enep coalition if crisis==0, re
outreg2 using output5a.doc, replace ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o))
xtreg votesgov lagvotesgov wpcgrowth deltaturnout enep coalition if crisis==0, re
outreg2 using output5a.doc, append ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o))
xtreg votesgov lagvotesgov winflation deltaturnout enep coalition if crisis==0, re
outreg2 using output5a.doc, append ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o))

xtreg votesgov lagvotesgov wunemp deltaturnout enep coalition if crisis==0, mle
estat ic
xtreg votesgov lagvotesgov wpcgrowth deltaturnout enep coalition if crisis==0, mle
estat ic
xtreg votesgov lagvotesgov winflation deltaturnout enep coalition if crisis==0, mle
estat ic


xtreg votesgov lagvotesgov wunemp deltaturnout enep coalition if crisis==1, re
outreg2 using output5b.doc, replace ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o))
xtreg votesgov lagvotesgov wpcgrowth deltaturnout enep coalition if crisis==1, re
outreg2 using output5b.doc, append ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o))
xtreg votesgov lagvotesgov winflation deltaturnout enep coalition if crisis==1, re
outreg2 using output5b.doc, append ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o))

xtreg votesgov lagvotesgov wunemp deltaturnout enep coalition if crisis==1, mle
estat ic
xtreg votesgov lagvotesgov wpcgrowth deltaturnout enep coalition if crisis==1, mle
estat ic
xtreg votesgov lagvotesgov winflation deltaturnout enep coalition if crisis==1, mle
estat ic



***** Use unemployment trend instead of level (Tab A.9)  ***



xtreg votesgov lagvotesgov deltawunemp wpcgrowth deltaturnout enep coalition if crisis==0, re
outreg2 using output1b.doc, replace ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o))
xtreg votesgov lagvotesgov deltawunemp wpcgrowth deltaturnout enep coalition if crisis==1, re
outreg2 using output1b.doc, append ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o))

xtreg votesgov lagvotesgov deltawunemp wpcgrowth deltaturnout enep coalition if crisis==0, mle
estat ic
xtreg votesgov lagvotesgov deltawunemp wpcgrowth deltaturnout enep coalition if crisis==1, mle
estat ic


*** Interacting globalization with unemployment trend (Figure A.3)

** Economic globalization

xtreg votesgov lagvotesgov c.deltawunemp##c.ecokof wpcgrowth deltaturnout enep coalition if crisis==0, re
outreg2 using output6.doc, replace ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp ecokof polkof wpcgrowth deltaturnout enep coalition)
margins, dydx(deltawunemp) at(ecokof =(42(1)93)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of TREND IN UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist ecokof if crisis==0, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
xtitle(ECONOMIC GLOBALIZATION) title("(2000-2007)")

xtreg votesgov lagvotesgov c.deltawunemp##c.ecokof wpcgrowth deltaturnout enep coalition if crisis==1, re
outreg2 using output6.doc, append ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp ecokof polkof wpcgrowth deltaturnout enep coalition)
margins, dydx(deltawunemp) at(ecokof =(57(1)88)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of TREND IN UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist ecokof if crisis==1, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
xtitle(ECONOMIC GLOBALIZATION) title("(2008-2015)")


** Political globalization

xtreg votesgov lagvotesgov c.deltawunemp##c.polkof wpcgrowth deltaturnout enep coalition if crisis==0, re
outreg2 using output6.doc, append ctitle(Before, (2000-2007)) dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp ecokof polkof wpcgrowth deltaturnout enep coalition)
margins, dydx(deltawunemp) at(polkof =(53(1)99)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of TREND IN UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist polkof if crisis==0, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
xtitle(POLITICAL GLOBALIZATION) title("(2000-2007)")

xtreg votesgov lagvotesgov c.deltawunemp##c.polkof wpcgrowth deltaturnout enep coalition if crisis==1, re
outreg2 using output6.doc, append ctitle(After, (2008-2015)) dec(2) label addstat (R-squared, e(r2_o)) sortvar (lagvotesgov wunemp ecokof polkof wpcgrowth deltaturnout enep coalition)
margins, dydx(deltawunemp) at(polkof =(59(1)99)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash)) ///
yline(0, lcolor(red)) ytitle("Marginal effect of TREND IN UNEMPLOYMENT", axis(1)) title("") ///
addplot(hist polkof if crisis==1, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
xtitle(POLITICAL GLOBALIZATION) title("(2008-2015)")

****************************************
***** Interacting with institutions  ***
****************************************

**Euro (Figure A.4)

xtreg votesgov lagvotesgov c.wunemp##i.euro wpcgrowth deltaturnout enep coalition if crisis==0, re
margins, dydx(wunemp) at(euro=(0(1)1)) vsquish
marginsplot, yline(0, lcolor(red)) ytitle("Marginal Effect of UNEMPLOYMENT", axis(1)) xtitle(EURO) title("(2000-2007)")

xtreg votesgov lagvotesgov c.wunemp##i.euro wpcgrowth deltaturnout enep coalition if crisis==1, re
margins, dydx(wunemp) at(euro=(0(1)1)) vsquish
marginsplot, yline(0, lcolor(red)) ytitle("Marginal Effect of UNEMPLOYMENT", axis(1)) xtitle(EURO) title("(2008-2015)")


**Eu15 (Figure A.5)

xtreg votesgov lagvotesgov c.wunemp##i.eu15 wpcgrowth deltaturnout enep coalition if crisis==0, re
margins, dydx(wunemp) at(eu15=(0(1)1)) vsquish
marginsplot, yline(0, lcolor(red)) ytitle("Marginal Effect of UNEMPLOYMENT", axis(1)) xtitle(EU 15) title("(2000-2007)")

xtreg votesgov lagvotesgov c.wunemp##i.eu15 wpcgrowth deltaturnout enep coalition if crisis==1, re
margins, dydx(wunemp) at(eu15=(0(1)1)) vsquish
marginsplot, yline(0, lcolor(red)) ytitle("Marginal Effect of UNEMPLOYMENT", axis(1)) xtitle(EU 15) title("(2008-2015)")

